package gui.components.map.objects;

import java.awt.Shape;
import java.awt.geom.Line2D;

public class objDirectionPoint {

	private Line2D _directionpoint = null;
	
	private double _direction = 0;
	private double _radius = 7;
	private double _offset = 0;
	
	private double _beginx, _beginy = 0;
	private double _endx, _endy = 0;
	
	
	public objDirectionPoint()
	{
		// Create new line
		_directionpoint = new Line2D.Double();
	
		// Set offset from start of line
		_beginx = _beginy = _offset > 0 ? _offset : 0;
	}
	
	public Shape Generate(objBasic _obj)
	{
		// Set direction
		_direction = _obj.getDirection();
		
		// Calculate end coordinates (x,y) from line
		_endx = 0 + _radius * Math.cos((Math.toRadians(_direction)));
		_endy = 0 + _radius * Math.sin((Math.toRadians(_direction)));
		
		// Create line
		_directionpoint.setLine(_beginx, _beginy, _endx, _endy);
		
		// Return line
		return _directionpoint;
		
	}
}
